import pandas as pd
import numpy as np
unemployment_2018 = pd.read_csv(r"D:\nwank\Documents\Project\Cbs.csv")
unemployment_2018.head()
| State No | State | Labour force | Unemployment Rate | |
|---|---|---|---|---|
| 0 | 32 | ABIA | 2,023,768 | 31.6 |
| 1 | 3 | ADAMAWA | 1,588,278 | 20.8 |
| 2 | 7 | AKWA-IBOM | 3,599,981 | 37.7 |
| 3 | 11 | ANAMBRA | 3,251,915 | 17.5 |
| 4 | 8 | BAUCHI | 2,122,724 | 23.5 |
import plotly
import plotly.io as pio
import plotly.express as px
import plotly.graph_objs as go
fig = px.bar(unemployment_2018, y = 'Unemployment Rate', x = 'State', orientation = 'v', color = 'Unemployment Rate')
fig.show()
import json
with open (r"D:\Downloads\Nig_states.geojson") as f:
map_specs = json.load(f)
nigeria_coordinates = {"lat":9.0820, "lon":8.6753}
state_id_map={}
for feature in map_specs['features']:
feature['id'] = feature['properties']['OBJECTID']
state_id_map[feature['properties']['OBJECTID']] = feature['id']
fig = px.choropleth_mapbox(
unemployment_2018,
locations = "State No",
color = "Unemployment Rate",
center = nigeria_coordinates,
geojson = map_specs,
opacity = 0.7,
zoom = 4.5,
hover_name = "State",
color_continuous_scale="redor",
mapbox_style = "carto-positron",
labels = {"State No":"Unemployment Rate"}
)
fig.show()